package com.team7.controller;

import com.team7.common.vo.CommonResult;
import com.team7.service.CollectionTeacherService;
import com.team7.vo.AttentionVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @program: team7-Object02
 * @description: 讲师收藏
 * @author: 王子鑫
 * @create: 2021-10-21 21:32
 **/
@RestController
@RequestMapping("/service/collectionTeacher")
public class CollectionTeacherController {
    @Resource
    private CollectionTeacherService collectionTeacherService;

    //查询讲师是否关注
    @PostMapping("/findFavoriteTeacher")
    public CommonResult findFavoriteTeacher(@RequestBody AttentionVo attentionVo){
        return collectionTeacherService.findFavoriteTeacher(attentionVo);
    }

    //根据memberId查询讲师
    @PostMapping("/findFavoriteTeacherById/{memberId}")
    public CommonResult findFavoriteTeacherById(@PathVariable("memberId") String memberId){
        return collectionTeacherService.findFavoriteTeacherById(memberId);
    }

    //添加收藏讲师
    @PostMapping("/addFavoriteTeacher")
    public CommonResult addFavoriteTeacher(@RequestBody AttentionVo attentionVo){
        return collectionTeacherService.addFavoriteTeacher(attentionVo);
    }

    //取消收藏讲师
    @PostMapping("/deleteFavoriteTeacher")
    public CommonResult deleteFavoriteTeacher(@RequestBody AttentionVo attentionVo){
        return collectionTeacherService.deleteFavoriteTeacher(attentionVo);
    }
}